package com.lqian.simplestructure.linearlist;

import java.util.Arrays;
import java.util.concurrent.ArrayBlockingQueue;

/**
 * 删除数组(非有序数组)中重复的元素
 * @author：Melody_LQ
 * @time：2022/7/21 11:17 下午
 */
public class RemoveRepeatElement {

    public static void main(String[] args) {

        int[] nums = new int[]{9, 5, 2, 7, 2, 5, 3, 2, 4};
        int[] newNums = new int[nums.length];
        int index =0;
        for (int i = 0; i <nums.length ; i++) {
            for (int j = 0; j <nums.length ; j++) {
                if(i!=j){
                    if (nums[i] == nums[j]){
                        break;
                }

            }
                if (j == nums.length-1){
                    newNums[index++] = nums[i];
                }
        }
    }
        System.out.println(Arrays.toString(newNums));
    }
}
